package pl.planito.user.manager;

import java.util.Map;

import javax.ejb.EJB;
import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;

import pl.planito.user.info.UserDataBridge;
import pl.planito.user.managament.IUserRegisterLocal;
import pl.planito.util.DataOperations;

public class UserBean extends UserDataBridge implements DataOperations, LoginModule {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@EJB
	IUserRegisterLocal userRegisterLocal;
	private String repeatPassword;
	private boolean loggedIn = true;

	public boolean isLoggedIn() {
		return loggedIn;
	}

	public void setLoggedIn(boolean loggedIn) {
		this.loggedIn = loggedIn;
	}

	public String getRepeatPassword() {
		return repeatPassword;
	}

	public void setRepeatPassword(String repeatPassword) {
		this.repeatPassword = repeatPassword;
	}

	public void save() {
		userRegisterLocal.registerUser(this);
		return;
	}

	public void edit() {
		// TODO Auto-generated method stub

	}

	public boolean abort() throws LoginException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean commit() throws LoginException {
		// TODO Auto-generated method stub
		return false;
	}

	public void initialize(Subject subject, CallbackHandler callbackHandler,
			Map<String, ?> sharedState, Map<String, ?> options) {
		// TODO Auto-generated method stub
		
	}

	public boolean login() throws LoginException {
		
		return false;
	}

	public boolean logout() throws LoginException {
		// TODO Auto-generated method stub
		return false;
	}
}
